#coding=utf-8
from stscraper import get_shstcode, get_szstcode
from stvalidator import isValidStcode
from stutils import set_django_environ
set_django_environ()

from stdj.stock.models import Stcode

data = get_shstcode()
print '上海codes Done.'
data.extend( get_szstcode() )
print '深圳codes Done.'

for d in data:
    code, name = d
    isValidStcode(code)
    Stcode.objects.get_or_create(code=code, name=name)    
print 'stcode2db Done.'
